
package edu.ccut.saturn.authority.impl;



import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IParameterContext;

public class LimitToEndIndex extends DefaultComponent {
	@Override
	public void execute(IParameterContext parameterContext) throws Exception {
		
		int start, limit;
	
		try{
			start = Integer.parseInt(parameterContext.getParameterValue(0).toString());
		} catch (Exception e) {
			start = 0;
		}
		
		try{
			limit = Integer.parseInt(parameterContext.getParameterValue(1).toString());
		} catch (Exception e) {
			limit = 10;
		}

		int end = start + limit ;
		
		parameterContext.setParameter(3, end);
		parameterContext.setParameter(2, start+1);
	}
}